package com.chixing.day17_reflect_thread.thread;


public class AThread implements Runnable{
    private Thread b;
    public AThread(Thread b){
        this.b = b;
    }
    @Override
    public void run() {
        // 奇数 输出到21 ,让偶数线程全部执行结束（让步）
        for(int i =1;i<=50;i+=2){
            System.out.println(Thread.currentThread().getName()+   i);
            if(i == 21) {
                try {
                    b.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

            try {
                Thread.sleep(3);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
